Public Class OdemePlani
    Public Anapara As Decimal
    Public Ceza As Decimal

    ReadOnly Property Toplam() As Decimal
        Get
            Return Anapara + Ceza
        End Get
    End Property

End Class

Class Interval

    Public Tarih1, Tarih2 As Date

    Sub New(ByVal T1 As Date, ByVal T2 As Date)
        Tarih1 = T1
        Tarih2 = T2
    End Sub

    Function OverlappingDays(ByVal Interval As Interval) As Integer
        If Interval.Tarih1 > Tarih2 Then Return 0
        If Interval.Tarih2 < Tarih1 Then Return 0
        Dim T1 As Date = If(Interval.Tarih1 > Tarih1, Interval.Tarih1, Tarih1)
        Dim T2 As Date = If(Interval.Tarih2 < Tarih2, Interval.Tarih2, Tarih2)
        If T2 < T1 Then Return 0
        If T1.Month <> T1.AddDays(-1).Month And T2.Month <> T2.AddDays(1).Month Then Return 30
        Return DateDiff(DateInterval.Day, T1, T2) + 1
    End Function

End Class


